package com.ruoyi.asms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.asms.domain.AsmsFaultAssetReason;
import com.ruoyi.asms.mapper.AsmsFaultAssetReasonMapper;
import com.ruoyi.asms.service.IAsmsFaultAssetReasonService;
import com.ruoyi.common.core.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 资产故障原因Service业务层处理
 * 
 * @author yfkj
 * @date 2021-10-21
 */
@Service
public class AsmsFaultAssetReasonServiceImpl extends ServiceImpl<AsmsFaultAssetReasonMapper, AsmsFaultAssetReason>  implements IAsmsFaultAssetReasonService
{
    @Autowired
    private AsmsFaultAssetReasonMapper asmsFaultAssetReasonMapper;

    /**
     * 查询资产故障原因
     * 
     * @param faultAssetReasonId 资产故障原因主键
     * @return 资产故障原因
     */
    @Override
    public AsmsFaultAssetReason selectAsmsFaultAssetReasonByFaultAssetReasonId(Long faultAssetReasonId)
    {
        return asmsFaultAssetReasonMapper.selectAsmsFaultAssetReasonByFaultAssetReasonId(faultAssetReasonId);
    }

    /**
     * 查询资产故障原因列表
     * 
     * @param asmsFaultAssetReason 资产故障原因
     * @return 资产故障原因
     */
    @Override
    public List<AsmsFaultAssetReason> selectAsmsFaultAssetReasonList(AsmsFaultAssetReason asmsFaultAssetReason)
    {
        return asmsFaultAssetReasonMapper.selectAsmsFaultAssetReasonList(asmsFaultAssetReason);
    }

    /**
     * 新增资产故障原因
     * 
     * @param asmsFaultAssetReason 资产故障原因
     * @return 结果
     */
    @Override
    public int insertAsmsFaultAssetReason(AsmsFaultAssetReason asmsFaultAssetReason)
    {
        asmsFaultAssetReason.setCreateTime(System.currentTimeMillis());
        asmsFaultAssetReason.setCreateBy(SecurityUtils.getUsername());
        return asmsFaultAssetReasonMapper.insertAsmsFaultAssetReason(asmsFaultAssetReason);
    }

    /**
     * 修改资产故障原因
     * 
     * @param asmsFaultAssetReason 资产故障原因
     * @return 结果
     */
    @Override
    public int updateAsmsFaultAssetReason(AsmsFaultAssetReason asmsFaultAssetReason)
    {
        asmsFaultAssetReason.setUpdateTime(System.currentTimeMillis());
        asmsFaultAssetReason.setUpdateBy(SecurityUtils.getUsername());

        return asmsFaultAssetReasonMapper.updateAsmsFaultAssetReason(asmsFaultAssetReason);
    }

    /**
     * 批量删除资产故障原因
     * 
     * @param faultAssetReasonIds 需要删除的资产故障原因主键
     * @return 结果
     */
    @Override
    public int deleteAsmsFaultAssetReasonByFaultAssetReasonIds(Long[] faultAssetReasonIds)
    {
        return asmsFaultAssetReasonMapper.deleteAsmsFaultAssetReasonByFaultAssetReasonIds(faultAssetReasonIds);
    }

    /**
     * 删除资产故障原因信息
     * 
     * @param faultAssetReasonId 资产故障原因主键
     * @return 结果
     */
    @Override
    public int deleteAsmsFaultAssetReasonByFaultAssetReasonId(Long faultAssetReasonId)
    {
        return asmsFaultAssetReasonMapper.deleteAsmsFaultAssetReasonByFaultAssetReasonId(faultAssetReasonId);
    }
}
